/**
 * @description: 首页大屏配置数据
 * @param {*}
 * @return {*}
 */
// 使用 Mock
var Mock = require('mockjs')
var mockData = Mock.mock({
  // 属性 list 的值是一个数组，其中含有 1 到 10 个元素
  'list|5': [{
    // 属性 id 是一个自增数，起始值为 1，每次增 1
    'id|+1': 1,
    'value|100-500': 100
  }]
})
var cropType = ['小麦', '豆类', '油料', '蔬菜', '水果'];
let data = [];
for (let i = 0; i < mockData.list.length; i++) {
  let item = {
    'value': mockData.list[i].value,
    'name': cropType[i]
  }
  data.push(item);

}

let headOptions = [
  {
    title: {
      text: '农业产量',
      left: 'center'
    },
    tooltip: {
      trigger: 'item'
    },
    legend: {
      orient: 'vertical',
      left: 'left',
    },
    series: [
      {
        name: '访问来源',
        type: 'pie',
        radius: '50%',
        data: data,
        emphasis: {
          itemStyle: {
            shadowBlur: 10,
            shadowOffsetX: 0,
            shadowColor: 'rgba(0, 0, 0, 0.5)'
          }
        }
      }
    ]
  },
  //------------------------------------------------------------
  {
    title: {
      text: '农业收量',
      left: 'center'
    },
    legend: {
      top: 'bottom',
    },
    series: [
      {
        name: '面积模式',
        type: 'pie',
        radius: [20, 100],
        center: ['50%', '50%'],
        roseType: 'area',
        itemStyle: {
          borderRadius: 8
        },
        data: data
      }
    ]
  },
  //------------------------------------------------------------
  {
    title: {
      text: '农业增量',
      left: 'center'
    },
    tooltip: {
      trigger: 'item'
    },

    legend: {
      top: '20',
      left: 'center'
    },
    series: [
      {
        name: '访问来源',
        type: 'pie',
        radius: ['40%', '70%'],
        avoidLabelOverlap: false,
        itemStyle: {
          borderRadius: 10,
          borderColor: '#fff',
          borderWidth: 2
        },
        label: {
          show: false,
          position: 'center'
        },
        emphasis: {
          label: {
            show: true,
            fontSize: '20',
            fontWeight: 'bold'
          }
        },
        labelLine: {
          show: false
        },
        data: data
      }
    ]
  },
  //------------------------------------------------------------

]

let contentOptions = [
  {
    color: '#91cc75',
    title: {
      show: true,
      text: '今年销量走势',
      left: 'center',
      top: '10'
    },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      data: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
      name: '月份'
    },
    yAxis: {
      type: 'value',
      name: '产量/KG'
    },
    series: [{
      // data: [820, 932, 901, 934, 1290, 1330, 1320, 1550, 1640, 1428, 1973, 1778],
      data: Mock.mock({
        'list|12': [{
          'value|500-1500': 500
        }]
      }).list,
      type: 'line',
      areaStyle: {}
    }],

  },
  {
    color: 'rgb(44,181,172)',
    title: {
      show: true,
      text: '本周销量',
      left: 'center',
      top: '10'
    },
    xAxis: {
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },
    yAxis: {
      type: 'value'
    },
    series: [{
      data: Mock.mock({
        'list|7': [{
          'value|500-1500': 500
        }]
      }).list,
      type: 'bar'
    }],
    selected: {
      color: 'rgb(213,58,53)'
    }
  }
]

export default {
  headOptions,
  contentOptions
}

